package com.xnj.print_stream_writer_demo;

import java.io.*;

// 打印流
public class Test1 {
    public static void main(String[] args) {
        try(
                // 1.创建一个字节打印流
//                PrintStream ps = new PrintStream("src/printTest.txt");
                // 2. 创建一个字符打印流
                PrintWriter ps = new PrintWriter("src/printTest.txt");

                ){
            ps.println("hello");//会自动换行
            ps.print("hh");//不换行
            ps.print(97);
            ps.println(98);


            ps.write(97);// a


        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
